package com.csjy.migration.hnnd.workflow;

import com.csjy.migration.hnnd.DbUtil;
import com.csjy.migration.hnnd.ProgramArgument;
import com.csjy.migration.hnnd.annotation.Task;
import com.csjy.migration.hnnd.business.NdBpmProjectArchive;
import com.csjy.migration.hnnd.business.SourceBusinessData;
import com.fasterxml.jackson.core.JsonProcessingException;

import javax.script.ScriptException;
import javax.swing.text.html.Option;
import java.sql.SQLException;
import java.util.*;

/**
 * 项目文件归档
 */
public class ItemArchiveSubmitHny extends WorkflowMigration {

  private NdBpmProjectArchive ndBpmProjectArchive = null;

  public ItemArchiveSubmitHny(DbUtil sourceDbUtil, DbUtil targetDbUtil, SourceBusinessData sourceData, ProgramArgument programArgument, String projectId, String procInstId, Map procInstRow) throws Exception {
    super(sourceDbUtil, targetDbUtil, sourceData, programArgument, projectId, procInstId, procInstRow);
    this.customInitData();
  }


  @Override
  public void customInitData() throws SQLException {
    ndBpmProjectArchive  = new NdBpmProjectArchive(this.sourceDbUtil,this.targetDbUtil,sourceData, programArgument,this.projectId,this.procInstId);
  }

  @Override
  public void customInsertOrUpdateData() throws Exception {
    ndBpmProjectArchive.start();
  }

  @Task("项目文件归档@责任人提交资料清单")
  public void migrationZrrtjzlqd() throws Exception {
    this.curModelMap.put("all", new String[]{"task1535420355624","下一步"});
    this.setCommonData(false,null);

    Map<String,Object> taskParam = this.initTaskParamMap();
    taskParam.put("isPigeonhole", "0");
    taskParam.put("archiveCategory", this.getArchiveCategory());

    this.actHiVarinstMap.put("task1535420355624",this.curNextStepUserIds);
    ndBpmProjectArchive.getTaskParamMap().put(this.curJbpmTaskInstanceId, taskParam);
  }

  @Task("项目文件归档@档案管理员接收处理")
  public void migrationDaglyjscl() throws Exception {
    this.curModelMap.put("确认接收", new String[]{"endqrjs","确认接收"});
    this.curModelMap.put("未接收资料", new String[]{"endwjszl","未接收资料"});
    this.setCommonData(false,null);

    Map<String,Object> taskParam = this.initTaskParamMap();
    taskParam.put("isPigeonhole", "1");
    taskParam.put("archiveCategory", this.getArchiveCategory());
    ndBpmProjectArchive.getTaskParamMap().put(this.curJbpmTaskInstanceId, taskParam);
  }


}
